using System;

namespace UNLV.IAP.WebControls
{
	/// <summary>
	/// Represents a Field used in a SqlWhereBuilder control
	/// </summary>
	[Serializable]
	public class SqlWhereBuilderField
	{

		private string _id;
		private string _text;
		private string _opsListId;
		private System.Data.DbType _paramDataType;


		/// <summary>
		/// Unique identifier for this field
		/// </summary>
		/// <remarks>
		/// The <b>Id</b> property should be a field name from the table
		/// for which the SQL WHERE clause is being built.  Its value
		/// is inserted for an Operator's <b>#FIELD</b> placeholder when translating
		/// conditions into a where clause.
		/// The <b>Text</b> property is the friendly display name appearing
		/// in the Fields dropdown.
		/// </remarks>
		public string Id
		{
			get {return _id;}
			set {_id = value;}
		}

		/// <summary>
		/// The friendly text to display in the Fields dropdown
		/// </summary>
		public string Text
		{
			get {return _text;}
			set {_text = value;}
		}

		/// <summary>
		/// The identifier for the OperatorList that should be associated
		/// with this field.
		/// </summary>
		public string OperatorListId
		{
			get {return _opsListId;}
			set {_opsListId = value;}
		}

		/// <summary>
		/// The datatype for parameter objects that are constructed for
		/// this field.
		/// </summary>
		public System.Data.DbType ParameterDataType
		{
			get {return _paramDataType;}
			set {_paramDataType = value;}
		}

		/// <summary>
		/// Constructs a SqlWhereBuilderField object
		/// </summary>
		public SqlWhereBuilderField()
		{
		}

		/// <summary>
		/// Constructs a SqlWhereBuilderField from the given parameters
		/// </summary>
		/// <param name="id">the field name, also serving as a unique identifier</param>
		/// <param name="text">the friendly text to display in the Fields dropdown</param>
		/// <param name="opsListId">the identifier of the OperatorList to be associated with this Field.</param>
		public SqlWhereBuilderField(string id, string text, string opsListId)
		{
			this.Id = id;
			this.Text = text;
			this.OperatorListId = opsListId;
		}
	
	}
}
